]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
Convert the check-for-missing files check to a python script
authorOwen W. Taylor <otaylor@fishsoup.net>
Tue, 23 Feb 2010 00:21:42 +0000 (19:21 -0500)
committerOwen W. Taylor <otaylor@fishsoup.net>
Tue, 23 Feb 2010 00:37:49 +0000 (19:37 -0500)
'git ls-files --exclude=<pattern>' was changed (intentionally!)
not to exclude anything files that are actually in the index.
Since git ls-files by default simply lists the files in the
index, this is a problem. Emulating this in shell went past
the limits of what made sense, so move it to a simple external
python script.

Makefile.am
tools/check-for-missing.py [new file with mode: 0755]

index 8957f9c1aceaff86a1f08bdbfeb78f48a164c729..cc3c02d310dbc36cc0e1353d186eeafbef6f9a03 100644 (file)
@@ -6,7 +6,8 @@ SUBDIRS = data js src tests po man
 EXTRA_DIST =           \
        .project        \
        .settings       \
-       autogen.sh
+       autogen.sh      \
+       tools/check-for-missing.py
 
 # These are files checked into Git that we don't want to distribute
 DIST_EXCLUDE =                                 \
@@ -17,14 +18,4 @@ DIST_EXCLUDE =                                       \
 
 distcheck-hook:
        @echo "Checking disted files against files in git"
-       @failed=false; \
-       exclude=`(for p in $(DIST_EXCLUDE) ; do echo --exclude=$$p ; done)`; \
-       for f in `cd $(srcdir) && git ls-files $$exclude` ; do \
-               if ! test -e $(distdir)/$$f ; then \
-                       echo File missing from distribution: $$f ; \
-                       failed=true ; \
-               fi \
-       done ; \
-       if $$failed ; then \
-               exit 1 ; \
-       fi
+       @$(srcdir)/tools/check-for-missing.py $(srcdir) $(distdir) $(DIST_EXCLUDE)
diff --git a/tools/check-for-missing.py b/tools/check-for-missing.py
new file mode 100755 (executable)
index 0000000..0a689d7
--- /dev/null
@@ -0,0 +1,25 @@
+#!/usr/bin/python
+#
+# This is a simple script that we use to check for files in git
+# and not in the distribution. It was previously written in shell
+# and inlined in the Makefile.am, but 'git ls-files --exclude=<pattern>'
+# was changed to no longer due anything useful, which made that
+# too challenging to be worthwhile.
+
+import fnmatch, os, subprocess, sys
+
+srcdir=sys.argv[1]
+distdir=sys.argv[2]
+excludes=sys.argv[3:]
+
+os.chdir(srcdir)
+
+status=0
+for f in subprocess.Popen(["git", "ls-files"], stdout=subprocess.PIPE).stdout:
+    f = f.strip()
+    if (not os.path.exists(os.path.join(distdir, f)) and
+        not any((fnmatch.fnmatch(f, p) for p in excludes))):
+        print "File missing from distribution:", f
+        status=1
+
+sys.exit(status)